package com.tentact.servlets;

import com.tentact.service.DeptService;
import com.tentact.vo.Department;

import javax.servlet.*;
import javax.servlet.http.*;
import javax.servlet.annotation.*;
import java.io.IOException;
import java.util.List;

@WebServlet(name = "selectDeptServlet", value = "/selectDeptServlet")
public class selectDeptServlet extends HttpServlet {
    DeptService service =new DeptService();
    @Override
    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        List<Department> departments =service.selectAllDept();

        request.setAttribute("departments",departments);
        request.getRequestDispatcher("departments.jsp").forward(request,response);

    }

    @Override
    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {

    }
}
